<template>
  <el-dialog :visible.sync="open" @close="close" :title="title" width="500px">
    <el-form ref="elForm" size="medium" label-width="100px">
      <el-form-item label="分组名称" prop="groupName">
        <el-input v-model="groupName" type="text" placeholder="请输入分组名称" :style="{ width: '100%' }">
        </el-input>
      </el-form-item>
    </el-form>
    <div slot="footer">
      <el-button @click="close">取消</el-button>
      <el-button type="primary" @click="handleConfirm">确定</el-button>
    </div>
  </el-dialog>
</template>
<script>
import dialogMixin from '../../../mixins/dialogMixin'
import * as DrillApi from '@/api/drill/drill.js';

export default {
  name: 'DrillRoleGroupEditDialog',
  mixins: [dialogMixin],
  components: {},
  props: [],
  data() {
    return {
      title: '编辑分组',
      groupId: 0,
      groupName: '',
      contentId: 0
    }
  },
  computed: {},
  watch: {},
  created() { },
  mounted() { },
  methods: {
    edit(data) {
      this.groupId = data.groupId;
      this.groupName = data.groupName;
      this.contentId = data.contentId;
      this.open = true;
    },
    add(contentId) {
      this.groupId = 0;
      this.groupName = '';
      this.contentId = contentId;
      this.open = true;
    },
    handleConfirm() {
      DrillApi.editDrillRoleGroup({ contentId: this.contentId, groupId: this.groupId, groupName: this.groupName }).then(res => {
        this.$emit('handleOk');
        this.open = false;
      })

    },
  }
}

</script>
<style>
</style>
